package org.dromara.merchants.dubbo;

import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.util.ObjectUtil;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.apache.dubbo.config.annotation.DubboService;
import org.dromara.common.core.utils.MapstructUtils;
import org.dromara.merchants.api.RemoteGoodsService;
import org.dromara.merchants.api.domain.vo.RemoteGoodsVo;
import org.dromara.merchants.domain.vo.TaGoodsVo;
import org.dromara.merchants.service.ITaGoodsService;
import org.springframework.stereotype.Service;

/**
 * @author xiyin321
 * @since 2024/7/9
 */
@Slf4j
@Service
@RequiredArgsConstructor
@DubboService
public class RemoteGoodsServiceImpl implements RemoteGoodsService {
    private final ITaGoodsService goodsService;

    /**
     * 根据id查询商品信息
     *
     * @param id
     * @return
     */
    @Override
    public RemoteGoodsVo queryGoodsById(Long id) {
        TaGoodsVo vo = goodsService.queryById(id);
        System.out.println(vo);

        return BeanUtil.copyProperties(vo, RemoteGoodsVo.class);
    }
}
